.container {
  --padding: 5px 15px 5px 7px;
  position: relative;

  &__inner {
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    background-color: var(--vscode-input-background);
    cursor: text;
    border: 1px solid var(--cwc-border-color);
    position: relative;

    &:hover {
      border-color: var(--cwc-border-color-hover);
    }

    &:focus-within {
      border-color: var(--vscode-focusBorder);
    }

    &--disabled {
      pointer-events: none;
      > * {
        opacity: 0.3;
      }
    }

    &--selecting {
      .keyword {
        pointer-events: none;
      }
    }
  }
}

.error {
  position: absolute;
  z-index: 2;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  &__inner {
    display: flex;
    text-align: center;
    align-items: center;
    padding: 3px 10px 3px 8px;
    font-weight: 500;
    color: var(--vscode-activityWarningBadge-foreground);
    background-color: var(--vscode-activityWarningBadge-background);
    border-radius: 999px;
    margin: 0 8px;

    &::before {
      content: '⚠';
      padding-right: 4px;
    }
  }
}

.input {
  padding: var(--padding);
  background-color: transparent;
  border: none;
  resize: none;
  position: relative;
  z-index: 1;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  letter-spacing: normal;
  min-height: 48px;

  &:focus {
    outline: none;
  }

  &--empty:before {
    content: attr(data-placeholder);
    position: absolute;
    color: var(--vscode-input-placeholderForeground);
    pointer-events: none;
  }

  & [data-type='ghost-text']::before {
    content: '\200B';
  }
}

.clear-button {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--vscode-icon-foreground);
  opacity: var(--dimmed-opacity);

  &::before {
    font-size: 13px !important;
  }

  &:hover {
    opacity: 1;
  }
}

.selection-keyword {
  background-color: var(--vscode-editor-selectionBackground);
  border-radius: 2px;
  padding: 0 0.6px;

  &--error {
    background-color: var(--vscode-diffEditor-removedLineBackground);
  }
}

.keyword {
  font-size: 12px;
  background-color: color-mix(
    in srgb,
    var(--vscode-charts-blue) 20%,
    transparent
  );
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
  transform: translateY(1.5px);
  max-width: 100%;

  &__icon {
    display: flex;
    padding: 0 3px;
    border-radius: 4px;
    position: relative;
    z-index: 1;
    cursor: pointer;

    &::before {
      font-family: 'codicon';
      font-size: 12px;
      transition: none;
      border-radius: 4px;
    }

    &:hover {
      background-color: color-mix(
        in srgb,
        var(--vscode-charts-blue) 30%,
        transparent
      );
    }
  }

  &__text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 4px;
    padding-right: 4px;
    padding-left: 4px;
    margin-left: -4px;
  }

  &:hover &__icon::before {
    content: '\ea76';
  }

  &--file &__icon::before {
    content: '\ea7b';
  }

  &--file &__text {
    cursor: pointer;
  }

  &--file &__text {
    &:hover {
      background-color: color-mix(
        in srgb,
        var(--vscode-charts-blue) 30%,
        transparent
      );
    }
  }

  &--changes &__icon::before {
    content: '\ebdb';
  }

  &--contextatcommit &__icon::before {
    content: '\ea82';
  }

  &--commit &__icon::before {
    content: '\eafc';
  }

  &--saved-context &__icon::before {
    content: '\eab3';
  }

  &--selection &__icon::before {
    content: '\eb84';
  }

  &--selection-error {
    background-color: color-mix(
      in srgb,
      var(--vscode-charts-red) 30%,
      transparent
    );
  }

  // hover on close icon of selection error
  &--selection-error &__icon:hover {
    background-color: color-mix(
      in srgb,
      var(--vscode-charts-red) 40%,
      transparent
    );
  }
}

.footer {
  display: flex;
  bottom: 0;
  right: 0;
  padding: 6px 10px 6px 6px;
  justify-content: space-between;
  position: relative;

  > div {
    flex-shrink: 0;
  }

  &__left {
    display: flex;

    &__button {
      --size: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      height: var(--size);
      width: var(--size);
      border-radius: 5px;

      &:hover {
        background-color: var(--vscode-toolbar-hoverBackground);
      }

      > svg {
        height: 11px;
        fill: var(--vscode-icon-foreground);
      }
    }
  }

  &__right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;

    &__edit-format {
      display: flex;
      align-items: center;
      gap: 6px;

      &__button {
        font-size: 11px;
        pointer-events: all;
        position: relative;
        font-weight: 500;
        color: transparent;

        &::before {
          content: attr(data-text);
          position: absolute;
          left: 0;
          top: 0;
          width: 100%;
          height: 100%;
          font-weight: normal;
          color: var(--vscode-foreground);
          opacity: 0.5;
        }

        &:hover {
          &::before {
            opacity: 1;
          }
        }

        &--selected {
          &::before {
            font-weight: 500;
            opacity: 1;
          }
        }
      }
    }

    &__submit {
      display: flex;
      align-items: center;
      pointer-events: all;
      position: relative;

      &__button {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 3px;
        height: 20px;
        border-radius: 5px;
        pointer-events: all;

        > svg {
          width: 10px;
          fill: var(--vscode-icon-foreground);
        }

        &.codicon::before {
          font-size: 16px;
        }

        &:hover:enabled {
          background-color: var(--vscode-toolbar-hoverBackground);
        }

        &:disabled {
          opacity: 0.5;
          cursor: default;

          &:hover {
            background-color: none;
          }
        }

        &--submit {
          padding: 0 2px;
        }

        &--chevron {
          > span.codicon::before {
            font-size: 11px;
            transition: transform 0.2s ease-in-out;
          }
        }

        &--toggled {
          transform: rotate(180deg);
        }

        &--copy {
          width: 20px;
        }
      }
    }
  }
}

.tooltip {
  position: absolute;
  z-index: 2;
  bottom: calc(100% - 2px);
  font-size: 12px;
  white-space: normal;
  max-width: calc(100vw - 50px);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 6px;
  background-color: var(--vscode-quickInput-background);
  border: 1px solid var(--vscode-widget-border);
  box-shadow: 0 0 8px 2px var(--vscode-widget-shadow);
  pointer-events: none;

  &--warning {
    &::before {
      font-family: 'codicon';
      content: '\ea6c';
      color: var(--vscode-problemsWarningIcon-foreground);
    }
  }

  &::after {
    content: '';
    position: absolute;
    bottom: -5px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--vscode-quickInput-background);
    filter: drop-shadow(0 1px 0.5px var(--vscode-widget-border));
  }

  &--align-left {
    left: 2px;
    &::after {
      left: var(--tooltip-offset);
    }
  }
  &--align-right {
    right: 2px;
    &::after {
      right: var(--tooltip-offset);
    }
  }
}
